# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>

pkgname=gnome-code-assistance
pkgver=3.16.1+r14+gaad6437
pkgrel=2
epoch=3
pkgdesc="Code assistance services for GNOME"
arch=(loong64 x86_64)
url="https://wiki.gnome.org/Projects/CodeAssistance"
license=(GPL3)
depends=(libgee python-dbus python-gobject python-pylint python-pyflakes python-pycodestyle
         python-lxml python-simplejson ruby-dbus ruby-sass)
makedepends=(intltool gobject-introspection llvm clang gjs go gnome-common git)
optdepends=('clang: Assistance for C and C++'
            'gjs: Assistance for JavaScript'
            'go: Assistance for Go')
options=(!lto) 
_commit=aad6437571461d35fe86c34a97f264e9bd7720c3  # master
source=("git+https://gitlab.gnome.org/GNOME/gnome-code-assistance.git#commit=$_commit")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/^v//;s/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd $pkgname
  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd $pkgname
  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
    --libexecdir=/usr/lib --disable-vala
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
  export GO111MODULE=off
  make
}

package(){
  cd $pkgname
  make DESTDIR="$pkgdir" install
}
